/** @file edit.h
 */
#ifndef _EDIT_H_
#define _EDIT_H_

extern "C" {
#include "font.h"
}

#include "widget.h"
#include "letter.h"
#include "signal.h"

typedef enum {
    SIGNAL_EDIT_CHANGED =0,
    SIGNAL_EDIT_LEAVE_FOCUS,
    SIGNAL_EDIT_MAX
} edit_signal;

class Edit:public Widget
{
public:
    Edit(HWND parent=0, char *txt=" ");
    ~Edit();
    
    bool isDigit();
    void setLen( char len);
    void setDigitMode(bool mode);
    char* getText();
    void setText(char *s);
    void setFont(FONT *font);

    //signals
    Signal signal[SIGNAL_EDIT_MAX];
    int keyShift;
private:
    FONT *font;
    bool digitMode;
    char text[20];
    void draw(Rect *r);
    virtual int eventHandler(HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam);
    void setupWidgets();
    void cleanWidgets();
    virtual void leaveFocus();
};

#endif
